package com.mowwang.file;

import java.io.*;

public class Copy {
    public static void main(String[] args) {
    copy();
    }


    public static void copy(){
        FileReader reader=null;
        FileWriter writer=null;
        BufferedReader br=null;
        BufferedWriter bw=null;
        try {
            reader= new FileReader("src/com/mowwang/file/Find.java");
            br=new BufferedReader(reader);
            writer=new FileWriter("Find.java");
            bw=new BufferedWriter(writer);
            //int n=-1;//当什么时候不读？，当等于-1的时候
            char[] chars=new char[1024];
            int m=-1;
           while ((m=reader.read(chars))!=-1)
           {
               writer.write(chars,0,m);
           }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                if (writer!=null)
                writer.close();
                if (reader!=null)
                reader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}